<?php

class AdminDAO extends DAO {
	public static function nusers()
	{
		$dbconf = self::dbhash(0, "pvn_global", "idtrans");
        $dbconn = self::getconn(0, $dbconf, __FUNCTION__);
        if (!$dbconn) return false;
        
        $sql = "select count(uid) from {$dbconf[4]}";
        $ret = self::dbquery($dbconn, $sql, "value");
        self::dbclose($dbconn);

		return $ret;
	}

	public static function ulist($page = 1, $pagesize = 20)
	{
		$page = intval($page);
		$page = $page ? $page : 1;
		$pagesize = intval($pagesize);
		$pagesize = $pagesize ? $pagesize : 20;
		$start = ($page - 1) * $pagesize;

        $dbconf = self::dbhash(0, "pvn_global", "idtrans");
        $dbconn = self::getconn(0, $dbconf, __FUNCTION__);
        if (!$dbconn) return false;
        
        $sql = "select * from {$dbconf[4]} limit {$start}, {$pagesize}";
        $ret = self::dbquery($dbconn, $sql, "rows");
        self::dbclose($dbconn);
        
        return $ret;
    }
}
?>